import java.util.Arrays;

/**
 * @ClassName LC2784
 * @Author ykx
 * @Date 2024/3/14 16:13
 * @Version 1.0
 */
public class LC2784 {
    public static void main(String[] args) {
        LC2784 lc2784 = new LC2784();
        int[] nums = {1, 3, 3, 2};
        System.out.println(lc2784.isGood(nums));
    }

    public boolean isGood(int[] nums) {
        Arrays.sort(nums);
        int[] result = new int[nums.length];
        for (int i = 0; i < result.length; i++) {
            result[i] = i + 1;
        }
        result[result.length - 1] -= 1;
        return Arrays.equals(nums, result);
    }
}
